// var i;
// var $eventManager = require("./EventManager");
// var $resKeeper = require("./ResKeeper");
// var $evenType = require("./EvenType");
// var u = cc._decorator;
// var d = u.ccclass;
// var p = (u.property, u.inspector);
// var h = (function (e) {
//     function t() {
//         return (null !== e && e.apply(this, arguments)) || this;
//     }
//     __extends(t, e);
//     t.prototype.onEnable = function () {
//         this.node.children[0].active = !1;
//         $eventManager.EventMgr.addEventListener($evenType.EVENT_TYPE.GAME_LOCK_SCREE, this.showLock, this);
//     };
//     t.prototype.onDisable = function () {
//         $eventManager.EventMgr.rmEventListener($evenType.EVENT_TYPE.GAME_LOCK_SCREE, this.showLock, this);
//     };
//     t.prototype.showLock = function (e) {
//         this.node.children[0].active = e;
//     };
//     return __decorate([d], t);
// })($resKeeper.default);
// exports.default = h;


import { EventMgrInstance } from './EventManager';
import ResKeeper from './ResKeeper';
import { EVENT_TYPE } from './EvenType';

const { ccclass, property, inspector } = cc._decorator;

/**
 * 锁屏管理类
 * 建议类名：LockScreenManager
 */
@ccclass
class ViewGameLock extends ResKeeper {
    /**
     * 当节点启用时调用
     * 建议方法名：handleEnable
     */
    onEnable(): void {
        // 隐藏第一个子节点
        this.node.children[0].active = false;
        // 添加游戏锁屏事件监听
        EventMgrInstance.addListener(EVENT_TYPE.GAME_LOCK_SCREE, this.toggleLockScreen, this);
    }

    /**
     * 当节点禁用时调用
     * 建议方法名：handleDisable
     */
    onDisable(): void {
        // 移除游戏锁屏事件监听
        EventMgrInstance.removeListener(EVENT_TYPE.GAME_LOCK_SCREE, this.toggleLockScreen, this);
    }

    /**
     * 显示或隐藏锁屏
     * @param isLocked 是否锁屏
     * 建议方法名：toggleLockScreen
     */
    toggleLockScreen(isLocked: boolean): void {
        // 根据传入参数设置第一个子节点的激活状态
        this.node.children[0].active = isLocked;
    }
}

export default ViewGameLock;